import { createI18n } from 'vue-i18n';
import en from '@/static/locales/en.json';
import hi from '@/static/locales/hi.json';
import zh from '@/static/locales/zh.json';
import ko from '@/static/locales/ko.json';
import ja from '@/static/locales/ja.json';
import th from '@/static/locales/th.json';
import de from '@/static/locales/de.json';
import fr from '@/static/locales/fr.json';
import es from '@/static/locales/es.json';
import id from '@/static/locales/id.json';
import zhtw from '@/static/locales/zhtw.json';
import kan from '@/static/locales/kan.json';
import mala from '@/static/locales/mala.json';
import mar from '@/static/locales/mar.json';
import tam from '@/static/locales/tam.json';
import tel from '@/static/locales/tel.json';
import hausa from '@/static/locales/hausa.json';
import urdu from '@/static/locales/urdu.json';
import mjl from '@/static/locales/mjl.json';
interface Messages {
  [key: string]: { [key: string]: string };
}

const messages: Messages = {
  en,
  hi,
  zh,
  ko,
  ja,
  th,
  de,
  fr,
  es,
  id,
  zhtw,kan,mala,mar,tam,tel,hausa,urdu,mjl
};
const i18n = createI18n({ 
legacy: false,
  locale: uni.getStorageSync('langs')?uni.getStorageSync('langs'):'en', //default language
  messages
});

export default i18n;